package com.tank.bean.product;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.GenericGenerator;

import com.tank.bean.User;
import com.tank.bean.item.Product;

@Entity
public class Offer {
	public static String TYPE_MONEY="money";
	public static String TYPE_ITEM="item";
	
	
	@GenericGenerator(name = "gen", strategy = "increment")
	@Id
	@GeneratedValue(generator = "gen")
	private Integer id;
	
	@ManyToOne
	private User author;//作者
	private Date pubtime;//发表时间
	@ManyToOne
	private Product product;//对哪个物品的提供的报价意愿
	private String type;//Offer.TYPE_MONEY||Offer.TYPE_ITEM
	private BigDecimal offerMoney;//提供的报价
	@ManyToOne
	private Product offerProduct;//提供的物品
	private Integer status;//offer状态，[意愿已提交，意愿达成【物主中意】，交易完成]，最后确定交易完成，允许物品主更改交换offerMoney的大小
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public User getAuthor() {
		return author;
	}
	public void setAuthor(User author) {
		this.author = author;
	}
	public Date getPubtime() {
		return pubtime;
	}
	public void setPubtime(Date pubtime) {
		this.pubtime = pubtime;
	}
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public BigDecimal getOfferMoney() {
		return offerMoney;
	}
	public void setOfferMoney(BigDecimal offerMoney) {
		this.offerMoney = offerMoney;
	}
	public Product getOfferProduct() {
		return offerProduct;
	}
	public void setOfferProduct(Product offerProduct) {
		this.offerProduct = offerProduct;
	}
	
	
	
}
